﻿using System.Collections;
using UnityEngine;

namespace Assets.Scripts.System
{
    public class PlayerSystem : MonoSingleton<PlayerSystem>, IBaseSystem
    {
        GameObject player = null;
        public AttributeData data;
        [Header("玩家按键")]
        [Header("闪避")]
        public float dodgeMoveSpeedScale = 2.0f;
        public float dodgeDuration = 0.5f;
        protected override void Awake()
        {
            base.Awake();
        }
        public void Open()
        {
            player = transform.root.Find("/Player").Find("Player").gameObject;
            data = GameManager.Instance.isDebug ? data : data.GetClone();
        }
        public void Close()
        {

        }

        public void OnUpdate()
        {

        }
        public void DisplayPlayer(bool isShow)
        {
            player.SetActive(isShow);
        }
        public void InitPlayer()
        {
            player.GetComponent<PlayerWeaponController>().Init();
            player.GetComponent<PlayerHealthController>().Init();
        }
        public void TranslatePlayerPos(Vector2 pos)
        {
            player.transform.position = pos;
        }
        public GameObject GetPlayerGO()
        {
            return player;
        }
        public AttributeData GetAttrData()
        {
            return data;
        }
    }
}